------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\ridelevel_analysis.log
  log type:  text
 opened on:  12 Jul 2024, 13:31:47

. 
. /*******************************************************************************
> ridelevel_analysis.do
> 
> Produces introductory and counterfactual figures and data on firm exits
> *******************************************************************************/
. 
. clear all

. 
. qui {

. 
. tab PA_stop_ride // Referenced in Section 6.1, Paragraph 4

PA_stop_rid |
          e |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,703       49.45       49.45
          1 |      2,763       50.55      100.00
------------+-----------------------------------
      Total |      5,466      100.00

. 
. qui {

. 
. preserve

. collapse (count) ambulance_id (min) date, by(year month)

. 
. sort date

. label values date dates

. twoway line ambulance_id date if year>=2003, ///
>         xti(" ") yti("Monthly Ambulance Rides") ///
>         xlab(15706 16802 17898 18993 20089 21185, val) ///
>         ylab(, format(%9.0gc)) ///
>         graphregion(color(white)) bgcolor(white)

. qui graph export "${outpath}Figure_1.pdf", as(pdf) replace // Figure 1

. restore

. 
. collapse (count) ambulance_id (sum) tot_pmt (min) date, by(year month priorauth_date)

. sort date

. label values date dates

. 
. twoway (line ambulance_id date if priorauth_date==1, lpattern(solid)) ///
>         (line ambulance_id date if priorauth_date==2, lpattern(longdash_dot)) ///
>         (line ambulance_id date if priorauth_date==0, lpattern(shortdash)) ///
>         (pcarrowi 90000 19850 90000 20050, color(black) ) ///
>         (pcarrowi 75000 20670 75000 20470, color(black) ), ///
>         xline(20058 20454) text( 90000 19850 "1st Reg.", place(w) size(small)) ///
>         text( 75000 20670 "2nd Reg.", place(e) size(small)) ///
>         xti(" ") yti("Total Monthly Dialysis Ambulance Rides") ///
>         xlab(15706 16802 17898 18993 20089 21185, val) ///
>         ylab(, format(%9.0gc)) ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(subti("Patient State of Residence") ///
>                 order(1 "NJ, SC, PA" 2 "DE, DC, MD, NC, VA, WV" 3 "No Prior Auth.")) ///
>         ti(" ")

. qui graph export "${outpath}Figure_2.pdf", as(pdf) replace // Figure 2

. 
. qui {

. 
. twoway (rarea payments_trend tot_pmt date if priorauth_date==0, fcolor(%30) lpattern(shortdash)) ///
>         (rarea payments_trend tot_pmt date if priorauth_date==1, fcolor(%30) lpattern(solid)) ///
>         (rarea payments_trend tot_pmt date if priorauth_date==2, fcolor(%30) lpattern(longdash_dot)) ///
>         (line payments_trend date if priorauth_date==1, lpattern(solid) lcolor(maroon)) ///
>         (line payments_trend date if priorauth_date==2, lpattern(longdash_dot) lcolor(forest_green)) ///
>         (line payments_trend date if priorauth_date==0, lpattern(shortdash) lcolor(navy)), ///
>         xti(" ") yti("Monthly Ambulance Payments (millions)") ///
>         xlab(15706 16802 17898 18993 20089 21185, val) ///
>         ylab(, format(%9.0gc)) ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(subti("Patient State of Residence") ///
>                 order(4 "NJ, SC, PA" 5 "DE, DC, MD, NC, VA, WV" 6 "No Prior Auth."))

. qui graph export "${outpath}Figure_A21.pdf", as(pdf) replace // Figure A19

. 
. twoway (rarea payments_counter tot_pmt date if priorauth_date==0, fcolor(%30) lpattern(shortdash)) ///
>         (rarea payments_counter tot_pmt date if priorauth_date==1, fcolor(%30) lpattern(solid)) ///
>         (rarea payments_counter tot_pmt date if priorauth_date==2, fcolor(%30) lpattern(longdash_dot)) ///
>         (line payments_counter date if priorauth_date==1, lpattern(solid) lcolor(maroon)) ///
>         (line payments_counter date if priorauth_date==2, lpattern(longdash_dot) lcolor(forest_green)) ///
>         (line payments_counter date if priorauth_date==0, lpattern(shortdash) lcolor(navy)), ///
>         xti(" ") yti("Monthly Ambulance Payments (millions)") ///
>         xlab(15706 16802 17898 18993 20089 21185, val) ///
>         ylab(, format(%9.0gc)) ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(subti("Patient State of Residence") ///
>                 order(4 "NJ, SC, PA" 5 "DE, DC, MD, NC, VA, WV" 6 "No Prior Auth."))

. qui graph export "${outpath}Figure_A22.pdf", as(pdf) replace // Figure A20

. 
. qui {

. 
. twoway  (rarea national_trend national_counter date if priorauth_date==0, lpatt(none) color(navy%30)) ///
>         (line national_pmt date if priorauth_date==0, lpattern(solid) lcolor(navy)) ///
>         (line national_trend date if priorauth_date==0, lpattern(longdash_dot) lcolor(navy)) ///
>         (line national_counter date if priorauth_date==0, lpattern(shortdash) lcolor(navy)), ///
>         xti(" ") yti("Monthly Ambulance Payments (millions)") ///
>         xlab(15706 16802 17898 18993 20089 21185, val) ///
>         ylab(, format(%9.0gc)) ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(order(2 "Actual" 3 "No Prior Auth." 4 "Always Prior Auth." 1 "Counterfactual Savings"))
(note:  named style none not found in class linepattern, default attributes used)
(note:  named style none not found in class linepattern, default attributes used)

. qui graph export "${outpath}Figure_A23.pdf", as(pdf) replace // Figure A21

. 
. list *saved* if _n==1 // Referenced in Section 1, Paragraph 7 and Section 7, Paragraph 1 and Appendix K, Paragraphs 1-3

     +--------------------------------------------------------------------------+
     | savedr~s   savedr~d   tot_s~es   savedpaym~6   savedpaym~d   tot_save~ts |
     |--------------------------------------------------------------------------|
  1. | 17505392    3703430   21208822   4083.090088   702.6105957   4785.700684 |
     +--------------------------------------------------------------------------+

. 
. log close
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\ridelevel_analysis.log
  log type:  text
 closed on:  12 Jul 2024, 13:34:38
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
